<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" >
<head>
    <meta charset="UTF-8">
    <title>布衣管理系统</title>
    <span th:include="/common/common :: commonOnLoad"></span>
</head>

<body class="easyui-layout">

    <table id="treegrid" title="菜单列表" class="easyui-treegrid"  toolbar="#tb"
           data-options="
				url: '/buyi/menu/doTreeGrid',
				method: 'get',
				lines: true,
				rownumbers: true,
				idField: 'id',
				treeField: 'menuid'
			">
        <thead>
            <tr>
                <th data-options="field:'menuid'" width="200">菜单ID</th>
                <th data-options="field:'text'" width="200">菜单名称</th>
                <th data-options="field:'url'" >URL</th>
                <th data-options="field:'iconCls'" >iconCls</th>
                <th data-options="field:'parentmenutext'" >上级菜单名称</th>
                <th data-options="field:'menuLevel'" >菜单级别</th>
                <th data-options="field:'sortno'" >菜单排序</th>
                <th data-options="field:'isvalid',formatter:formatProgress" >是否有效</th>
            </tr>
        </thead>
    </table>


    <div id="tb">
        <a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="javascript:add()">新增</a>
        <a href="#" class="easyui-linkbutton" iconCls="icon-cut" plain="true" onclick="javascript:alert('Cut')">修改</a>
        <a href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="javascript:alert('Save')">删除</a>
    </div>




    <div id="dd_update" class="easyui-dialog" title="菜单修改" style="width:400px;height:200px;" data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true">
    </div>

    <div id="dd_add" class="easyui-dialog" title="新增菜单" style="width:550px;height:250px;" data-options="iconCls:'icon-save',resizable:true,modal:true,closed:true">
    </div>


    <script>
        function formatProgress(value) {
            if (value==1){
                return "有效"
            } else{
                return "无效"
            }
        }

        function update(value) {
            $('#dd_update').dialog('refresh', '/buyi/menu/toTreeGrid');
            $('#dd_update').dialog("open");

            $.messager.alert('提示',value);
        }
        function remove(value) {

            $.messager.alert('提示',value);
        }

        function add() {
            $('#dd_add').dialog('refresh', '/buyi/menu/toinsert');
            $('#dd_add').dialog("open");
        }
    </script>


</body>
</html>